<?php
$this->breadcrumbs=array(
	'Services',
);

$this->menu=array(
	array('label'=>'绑定人人网帐号', 'url'=>array('createRenren')),
	array('label'=>'绑定Twitter帐号','url'=>array('createTwitter')),
	array('label'=>'绑定豆瓣帐号','url'=>array('createDouban')),
	//array('label'=>'绑定新浪微博帐号','url'=>array('createSina')),
	//array('label'=>'Manage Services', 'url'=>array('admin')),
);
?>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/setting.css" />
<h1>添加新服务</h1>
<?php 
$links = array(array('绑定人人网帐号', 'createRenren'), array('绑定Twitter帐号', 'createTwitter'), array('绑定豆瓣帐号', 'createDouban'));
echo '<ul class="addservices">';
foreach($links as $v) {
	echo '<li id="' .$v[1] . '">' . CHtml::link($v[0], array($v[1]), array('id'=>$v[1])) . '</li>';
}
echo '</ul>';
?>

<div style="clear:both"></div>
<h1>我的SNS服务</h1>
<ul class="myservices">
<?php
foreach ($dataProvider->getData() as $data) {
	$type = $data->type;
	echo '<li><ul id="' . $type .'">';
	//echo '<li>名称：' . CHtml::encode($type) . '</li>';
	$service = new $type($data->param1, $data->param2);
	//Yii::trace(print_r($service,true));
	echo '<li class="username">' . CHtml::encode($service->getMyName()) . '</li>';
	echo '<li>' . CHtml::link('[删除]', '#', array('submit'=>array('delete','id'=>$data->id),'confirm'=>'你确认要删除吗？') );
	echo '</ul></li>';
} ?>
</ul>

<div id="renrenlogin">
<?php
$model=new Services;
echo CHtml::beginForm(array('CreateRenren')); ?>
<?php echo CHtml::errorSummary($model); ?>
<div class="row">
        <?php echo CHtml::activeLabel($model,'人人网用户名：'); ?>
        <?php echo CHtml::activeTextField($model,'param1') ?>
    </div>
    <div class="row">
        <?php echo CHtml::activeLabel($model,'&nbsp;&nbsp;人人网密码：'); ?>
        <?php echo CHtml::activePasswordField($model,'param2') ?>
    </div>
    <div class="row submit">
        <?php echo CHtml::submitButton('绑定'); ?>
    </div>
 
<?php echo CHtml::endForm(); ?>
</div>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
	jQuery("a#createRenren").click(function(){jQuery("div#renrenlogin").show("normal");return false;})
//jQuery('body').
});
/*]]>*/
</script>
<?php /* $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
)); 
*/?>
